package de.hs_heilbronn;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean
@RequestScoped
public class Student {

	private int matrikel = 123456;
	private String vorname = "Vorname";
	private String nachname ="Nachname";
	
	public Student(){
		
	}
	
	public Student (int matrikel, String vorname, String nachname){
		this.matrikel = matrikel;
		this.vorname = vorname;
		this.nachname = nachname;
	}
	
	// creates a student data-set in database and returns a success-String
	public String create(){
		Database db = new Database();
		db.connectUpdate("INSERT INTO student (vorname, nachname) VALUES ('" + vorname + "','" + nachname + "');");
		return "success";
	}
		
	public int getMatrikel() {
		return matrikel;
	}
	public void setMatrikel(int matrikel) {
		this.matrikel = matrikel;
	}
	public String getVorname() {
		return vorname;
	}
	public void setVorname(String vorname) {
		this.vorname = vorname;
	}
	public String getNachname() {
		return nachname;
	}
	public void setNachname(String nachname) {
		this.nachname = nachname;
	}
	
	
	
}

